﻿@model OrderModel
@using SmartStore.Core.Domain.Tax;

<script type="text/javascript">
    $(document).ready(function () {
        toggleOrderTotals(false);
        toggleCC(false);
		toggleDD(false);

		$('#btnRefreshPage').click(function () {
			location.reload();
		});

		$('input.ask-to-proceed, button.ask-to-proceed').click(function (e) {
			if (confirm(@T("Admin.Common.AskToProceed").JsText)) {
				return true;
			}

			e.preventDefault();
			return false;
		});
    });

    function toggleOrderTotals(editmode) {
        if (editmode) {
            $('#trEditOrderTotals').show();
            $('#btnEditOrderTotals').hide();
            $('#btnSaveOrderTotals').show();
            $('#btnCancelOrderTotals').show();
        }
        else {
            $('#trEditOrderTotals').hide();
            $('#btnEditOrderTotals').show();
            $('#btnSaveOrderTotals').hide();
            $('#btnCancelOrderTotals').hide();
        }
    }

    function toggleCC(editmode) {
		if (editmode) {
			$('.cc-control').parent().hide();
			$('.cc-control').closest(".adminData").find("input").show();
            $('#btnEditCC').hide();
            $('#btnSaveCC').show();
            $('#btnCancelCC').show();
        }
        else {
			$('.cc-control').parent().show();
			$('.cc-control').closest(".adminData").find("input").hide();
            $('#btnEditCC').show();
            $('#btnSaveCC').hide();
            $('#btnCancelCC').hide();
        }
    }

    function toggleDD(editmode) {
		if (editmode) {
			$('.dd-control').parent().hide();
			$('.dd-control').closest(".adminData").find("input").show();
            $('#btnEditDD').hide();
            $('#btnSaveDD').show();
            $('#btnCancelDD').show();
        }
        else {
			$('.dd-control').parent().show();
			$('.dd-control').closest(".adminData").find("input").hide();
            $('#btnEditDD').show();
            $('#btnSaveDD').hide();
            $('#btnCancelDD').hide();
        }
    }
</script>

@Html.Widget("order_edit_top")

<table class="adminContent">
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.OrderStatus)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.OrderStatus
			</div>
			@if (Model.CanCancelOrder || Model.CanCompleteOrder)
			{
				<div>
					@if (Model.CanCancelOrder)
					{
						<button type="submit" name="cancelorder" id="cancelorder" class="btn btn-sm btn-danger ask-to-proceed" value="@T("Admin.Orders.Fields.OrderStatus.Cancel")">
							<span>@T("Admin.Orders.Fields.OrderStatus.Cancel")</span>
						</button>
					}

					@if (Model.CanCompleteOrder)
					{
						<button type="submit" name="completeorder" id="completeorder" class="btn btn-sm btn-warning ask-to-proceed" value="@T("Enums.SmartStore.Core.Domain.Orders.OrderStatus.Complete")">
							<i class="fa fa-check"></i>
							<span>@T("Enums.SmartStore.Core.Domain.Orders.OrderStatus.Complete")</span>
						</button>
					}
				</div>
			}
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.OrderNumber)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.OrderNumber
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.OrderGuid)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.OrderGuid
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.StoreName)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.StoreName
			</div>
		</td>
	</tr>
	@if (Model.AffiliateId != 0)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.AffiliateId)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<a href="@Url.Action("Edit", "Affiliate", new { id = Model.AffiliateId })">@Model.AffiliateFullName</a>
				</div>
			</td>
		</tr>
	}
	<tr class="adminSeparator">
		<td colspan="2">
			<hr />
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.CustomerId)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				<a href="@Url.Action("Edit", "Customer", new { id = Model.CustomerId })">@Model.CustomerName</a>
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.CustomerIp)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.CustomerIp
			</div>
		</td>
	</tr>
	@if (Model.RecurringPaymentId > 0)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.RecurringPaymentId)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<a href="@Url.Action("Edit", "RecurringPayment", new { id = Model.RecurringPaymentId })">@T("Admin.Common.View")</a>
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.VatNumber))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.VatNumber)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.VatNumber
				</div>
			</td>
		</tr>
	}
	@if (Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.IncludingTax)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderSubtotalInclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderSubtotalInclTax
				</div>
			</td>
		</tr>
	}
	@if (Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderSubtotalExclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderSubtotalExclTax
				</div>
			</td>
		</tr>
	}
	@if ((Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.IncludingTax) && !String.IsNullOrEmpty(Model.OrderSubTotalDiscountInclTax))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderSubTotalDiscountInclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderSubTotalDiscountInclTax
				</div>
			</td>
		</tr>
	}
	@if ((Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.ExcludingTax) && !String.IsNullOrEmpty(Model.OrderSubTotalDiscountExclTax))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderSubTotalDiscountExclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderSubTotalDiscountExclTax
				</div>
			</td>
		</tr>
	}
	@if (Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.IncludingTax)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderShippingInclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderShippingInclTax
				</div>
			</td>
		</tr>
	}
	@if (Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.ExcludingTax)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderShippingExclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderShippingExclTax
				</div>
			</td>
		</tr>
	}
	@if ((Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.IncludingTax) && !String.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeInclTax))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.PaymentMethodAdditionalFeeInclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.PaymentMethodAdditionalFeeInclTax
				</div>
			</td>
		</tr>
	}
	@if ((Model.AllowCustomersToSelectTaxDisplayType || Model.TaxDisplayType == TaxDisplayType.ExcludingTax) && !String.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeExclTax))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.PaymentMethodAdditionalFeeExclTax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.PaymentMethodAdditionalFeeExclTax
				</div>
			</td>
		</tr>
	}
	@if (Model.DisplayTaxRates)
	{
		foreach (var tr in Model.TaxRates)
		{
			<tr>
				<td class="adminTitle">
					@Html.SmartLabelFor(model => model.Tax)
				</td>
				<td class="adminData">
					<div class="form-control-plaintext">
						@tr.Rate% - @tr.Value
					</div>
				</td>
			</tr>
		}
	}
	@if (Model.DisplayTax)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Tax)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.Tax
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.OrderTotalDiscount))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderTotalDiscount)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderTotalDiscount
				</div>
			</td>
		</tr>
	}
	@foreach (var gc in Model.GiftCards)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.GiftCards[0].CouponCode) (@(gc.CouponCode))
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@gc.Amount
				</div>
			</td>
		</tr>
	}
	@if (Model.RedeemedRewardPoints > 0)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.RedeemedRewardPoints)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.RedeemedRewardPoints @T("Admin.Orders.Fields.RedeemedRewardPoints.Points")
					/
					@Model.RedeemedRewardPointsAmount
				</div>
			</td>
		</tr>
	}
	@if (Model.CreditBalance.HasValue())
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CreditBalance)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.CreditBalance
				</div>
			</td>
		</tr>
	}
	@if (Model.OrderTotalRounding.HasValue())
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.OrderTotalRounding)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.OrderTotalRounding
				</div>
			</td>
		</tr>
	}
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.OrderTotal)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.OrderTotal
			</div>
		</td>
	</tr>
	@if (Model.RefundedAmount.HasValue())
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.RefundedAmount)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext text-danger">
					@Model.RefundedAmount
				</div>
			</td>
		</tr>
	}

	<tr id="trEditOrderTotals">
		<td>
			<div class="card">
				<table class="adminContent card-body">
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderSubtotalInclTaxValue)
						</td>
						<td class="adminData form-horizontal">
							@Html.EditorFor(model => model.OrderSubtotalInclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.InclTax").Text })
							<div class="mt-3">
								@Html.EditorFor(model => model.OrderSubtotalExclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.ExclTax").Text })
							</div>
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderSubTotalDiscountInclTaxValue)
						</td>
						<td class="adminData form-horizontal">
							@Html.EditorFor(model => model.OrderSubTotalDiscountInclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.InclTax").Text })
							<div class="mt-3">
								@Html.EditorFor(model => model.OrderSubTotalDiscountExclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.ExclTax").Text })
							</div>
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderShippingInclTaxValue)
						</td>
						<td class="adminData form-horizontal">
							@Html.EditorFor(model => model.OrderShippingInclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.InclTax").Text })
							<div class="mt-3">
								@Html.EditorFor(model => model.OrderShippingExclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.ExclTax").Text })
							</div>
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.PaymentMethodAdditionalFeeInclTaxValue)
						</td>
						<td class="adminData form-horizontal">
							@Html.EditorFor(model => model.PaymentMethodAdditionalFeeInclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.InclTax").Text })
							<div class="mt-3">
								@Html.EditorFor(model => model.PaymentMethodAdditionalFeeExclTaxValue, new { postfix = T("Admin.Orders.Fields.Edit.ExclTax").Text })
							</div>
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.TaxRatesValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.TaxRatesValue)
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.TaxValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.TaxValue)
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderTotalDiscountValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.OrderTotalDiscountValue)
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.CreditBalanceValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.CreditBalanceValue)
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderTotalRoundingValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.OrderTotalRoundingValue)
						</td>
					</tr>
					<tr>
						<td class="adminTitle">
							@Html.SmartLabelFor(model => model.OrderTotalValue)
						</td>
						<td class="adminData">
							@Html.EditorFor(model => model.OrderTotalValue)
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
	<tr>
		<td>
			<button type="submit" name="btnEditOrderTotals" onclick="toggleOrderTotals(true);return false;" id="btnEditOrderTotals" class="btn btn-secondary">
				<i class="far fa-edit"></i>
				<span>@T("Admin.Orders.Fields.EditOrderTotals")</span>
			</button>
			<button type="submit" name="btnSaveOrderTotals" id="btnSaveOrderTotals" class="btn btn-warning ask-to-proceed" value="@T("Admin.Orders.Fields.SaveOrderTotals")">
				<i class="fa fa-check"></i>
				<span>@T("Admin.Orders.Fields.SaveOrderTotals")</span>
			</button>
			<button type="submit" name="btnCancelOrderTotals" onclick="toggleOrderTotals(false);return false;" id="btnCancelOrderTotals" class="btn btn-secondary">
				<span>@T("Admin.Common.Cancel")</span>
			</button>

			@{ Html.RenderWidget("admin_order_total_edit_buttons_after"); }
		</td>
	</tr>

	<tr class="adminSeparator">
		<td colspan="2">
			<hr />
		</td>
	</tr>

	@if (Model.AllowStoringCreditCardNumber)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardType)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardType" class="cc-control">@Model.CardType</span>
				</div>
				@Html.EditorFor(model => model.CardType)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardName)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardName" class="cc-control">@Model.CardName</span>
				</div>
				@Html.EditorFor(model => model.CardName)
			</td>
		</tr>
	}
	@if (Model.AllowStoringCreditCardNumber || !String.IsNullOrEmpty(Model.CardNumber))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardNumber)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardNumber" class="cc-control">@Model.CardNumber</span>
				</div>
				@Html.EditorFor(model => model.CardNumber)
			</td>
		</tr>
	}
	@if (Model.AllowStoringCreditCardNumber)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardCvv2)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardCvv2" class="cc-control">@Model.CardCvv2</span>
				</div>
				@Html.EditorFor(model => model.CardCvv2)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardExpirationMonth)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardExpirationMonth" class="cc-control">@Model.CardExpirationMonth</span>
				</div>
				@Html.EditorFor(model => model.CardExpirationMonth)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CardExpirationYear)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblCardExpirationYear" class="cc-control">@Model.CardExpirationYear</span>
				</div>
				@Html.EditorFor(model => model.CardExpirationYear)
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<button type="submit" name="btnEditCC" value="@T("Admin.Orders.Fields.EditCC")" onclick="toggleCC(true);return false;" id="btnEditCC" class="btn btn-secondary">
					<i class="far fa-edit"></i>
					<span>@T("Admin.Orders.Fields.EditCC")</span>
				</button>
				<button type="submit" name="btnSaveCC" value="@T("Admin.Orders.Fields.SaveCC")" id="btnSaveCC" class="btn btn-secondary ask-to-proceed">
					<i class="fa fa-check"></i>
					<span>@T("Admin.Orders.Fields.SaveCC")</span>
				</button>
				<button type="submit" name="btnCancelCC" value="@T("Admin.Orders.Fields.CancelCC")" onclick="toggleCC(false);return false;" id="btnCancelCC" class="btn btn-secondary">
					<span>@T("Admin.Orders.Fields.CancelCC")</span>
				</button>
			</td>
		</tr>
		<tr class="adminSeparator">
			<td colspan="2">
				<hr />
			</td>
		</tr>
	}

	@if (Model.AllowStoringDirectDebit)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitAccountHolder)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitAccountHolder" class="dd-control">@Model.DirectDebitAccountHolder</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitAccountHolder)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitAccountNumber)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitAccountNumber" class="dd-control">@Model.DirectDebitAccountNumber</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitAccountNumber)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitBankCode)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitBankCode" class="dd-control">@Model.DirectDebitBankCode</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitBankCode)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitBankName)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitBankName" class="dd-control">@Model.DirectDebitBankName</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitBankName)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitBIC)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitBIC" class="dd-control">@Model.DirectDebitBIC</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitBIC)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitCountry)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitCountry" class="dd-control">@Model.DirectDebitCountry</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitCountry)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DirectDebitIban)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					<span id="lblDirectDebitIban" class="dd-control">@Model.DirectDebitIban</span>
				</div>
				@Html.EditorFor(model => model.DirectDebitIban)
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<button type="submit" name="btnEditDD" value="@T("Admin.Orders.Fields.EditDD")" onclick="toggleDD(true);return false;" id="btnEditDD" class="btn btn-secondary">
					<i class="far fa-edit"></i>
					<span>@T("Admin.Orders.Fields.EditDD")</span>
				</button>
				<button type="submit" name="btnSaveDD" value="@T("Admin.Orders.Fields.SaveDD")" id="btnSaveDD" class="btn btn-secondary ask-to-proceed">
					<i class="fa fa-check"></i>
					<span>@T("Admin.Orders.Fields.SaveDD")</span>
				</button>
				<button type="submit" name="btnCancelDD" value="@T("Admin.Orders.Fields.CancelDD")" onclick="toggleDD(false);return false;" id="btnCancelDD" class="btn btn-secondary">
					<span>@T("Admin.Orders.Fields.CancelDD")</span>
				</button>
			</td>
		</tr>
		<tr class="adminSeparator">
			<td colspan="2">
				<hr />
			</td>
		</tr>
	}

	@if (Model.DisplayCompletePaymentNote)
	{
		<tr>
			<td colspan="2">
				<div class="alert alert-warning">
					@Html.Raw(T("Order.CompletePayment.AdminNote", Url.Action("Details", "Order", new { id = Model.Id, area = "" })))
				</div>
			</td>
		</tr>
	}
	@if (Model.DisplayPurchaseOrderNumber)
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.PurchaseOrderNumber)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.PurchaseOrderNumber
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.AuthorizationTransactionId))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.AuthorizationTransactionId)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.AuthorizationTransactionId
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.AuthorizationTransactionResult))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.AuthorizationTransactionResult)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.AuthorizationTransactionResult
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.CaptureTransactionId))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CaptureTransactionId)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.CaptureTransactionId
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.CaptureTransactionResult))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CaptureTransactionResult)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.CaptureTransactionResult
				</div>
			</td>
		</tr>
	}
	@if (!String.IsNullOrEmpty(Model.SubscriptionTransactionId))
	{
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.SubscriptionTransactionId)
			</td>
			<td class="adminData">
				<div class="form-control-plaintext">
					@Model.SubscriptionTransactionId
				</div>
			</td>
		</tr>
	}
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.PaymentMethod)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Model.PaymentMethod
				@if (Model.PaymentMethodSystemName.HasValue())
				{
					<span class="muted">(@Model.PaymentMethodSystemName)</span>
				}
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.PaymentStatus)
		</td>
		<td class="adminData wide">
			<span class="pr-1 font-weight-medium form-control-plaintext d-inline-block" style="width: auto;">@Model.PaymentStatus</span>

			@if (Model.CanMarkOrderAsPaid)
			{
				<input type="submit" name="markorderaspaid" value="@T("Admin.Orders.Fields.MarkAsPaid")" id="markorderaspaid" class="btn btn-secondary ask-to-proceed" title="@T("Admin.Orders.Fields.MarkAsPaid.Hint")" />
			}
			@if (Model.CanCapture)
			{
				<input type="submit" name="captureorder" value="@T("Admin.Orders.Fields.Capture")" id="captureorder" class="btn btn-primary ask-to-proceed" title="@T("Admin.Orders.Fields.Capture.Hint")" />
			}
			@if (Model.CanRefund)
			{
				<input type="submit" name="refundorder" value="@T("Admin.Orders.Fields.Refund")" id="refundorder" class="btn btn-primary ask-to-proceed" title="@T("Admin.Orders.Fields.Refund.Hint")" />
			}
			@if (Model.CanRefundOffline)
			{
				<input type="submit" name="refundorderoffline" value="@T("Admin.Orders.Fields.RefundOffline")" id="refundorderoffline" class="btn btn-secondary ask-to-proceed" title="@T("Admin.Orders.Fields.RefundOffline.Hint")" />
			}
			@if (Model.CanPartiallyRefund)
			{
				<input type="submit" id="partiallyrefundorder" name="partiallyrefundorder" value="@T("Admin.Orders.Fields.PartialRefund")" class="btn btn-primary"
					   onclick="javascript:openPopup('@(Url.Action("PartiallyRefundOrderPopup", "Order", new { id = Model.Id, online = true, btnId = "btnRefreshPage", formId = "order-form" }))'); return false;"
					   title="@T("Admin.Orders.Fields.PartialRefund.Hint")" />
			}
			@if (Model.CanPartiallyRefundOffline)
			{
				<input type="submit" id="partiallyrefundorderoffline" name="partiallyrefundorderoffline" value="@T("Admin.Orders.Fields.PartialRefundOffline")" class="btn btn-secondary"
					   onclick="javascript:openPopup('@(Url.Action("PartiallyRefundOrderPopup", "Order", new { id = Model.Id, online = false, btnId = "btnRefreshPage", formId = "order-form" }))'); return false;"
					   title="@T("Admin.Orders.Fields.PartialRefundOffline.Hint")" />
			}
			@if (Model.CanVoid)
			{
				<input type="submit" name="voidorder" value="@T("Admin.Orders.Fields.Void")" id="voidorder" class="btn btn-primary ask-to-proceed" title="@T("Admin.Orders.Fields.Void.Hint")" />
			}
			@if (Model.CanVoidOffline)
			{
				<input type="submit" name="voidorderoffline" value="@T("Admin.Orders.Fields.VoidOffline")" id="voidorderoffline" class="btn btn-secondary ask-to-proceed" title="@T("Admin.Orders.Fields.VoidOffline.Hint")" />
			}

			@{ Html.RenderWidget("admin_order_edit_payment_buttons_after"); }
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.CreatedOn)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Html.DisplayFor(model => model.CreatedOn)
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.UpdatedOn)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@Html.DisplayFor(model => model.UpdatedOn)
			</div>
		</td>
	</tr>
	<tr class="adminSeparator">
		<td colspan="2">
			<hr />
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.AcceptThirdPartyEmailHandOver)
		</td>
		<td class="adminData">
			<div class="form-control-plaintext">
				@(Model.AcceptThirdPartyEmailHandOver ? T("Common.Yes") : T("Common.No"))
			</div>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			@if (Model.CustomerComment.HasValue())
			{
				<h4>@T("Admin.Order.CustomerComment.Heading")</h4>
				<div class="alert alert-info">
					@Model.CustomerComment
				</div>
			}
		</td>
	</tr>
</table>